package com.mz.mattress.client.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mz.mattress.api.entity.Card;
import com.mz.mattress.api.entity.CardMerchant;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CardMerchantMapper extends BaseMapper<CardMerchant> {

    @Select("select * from mz_card_merchant where card_id=#{cardId} and deleted=0")
    List<CardMerchant> selectByCardId(Integer cardId);

    @Select("select a.* from mz_card a left join mz_card_merchant b on a.id=b.card_id where b.merchant_id=#{merchantId} and a.status=1 and a.deleted=0")
    List<Card> selectByMerchantId(@Param("merchantId") Integer merchantId);

}
